package com.company;

public class TaxiCharging_HJQ {

    // 出租车计费系统的计算规则
    public static double calculateFare(double distance, int waitingTime) {
        double price;
        if (distance <= 8) { // with first test
            price = distance * 0.8;
        } else { // with second test
            price = 8 * 0.8 + (distance - 8) * 0.8 * 1.5;
            price += (distance - 8) * 0.8 * 0.5;
        }
        price += waitingTime * 0.25; // with third test
        return price;
    }

}
